<template>
  <div id="center">
    <div class="up"> <!--base top  基础数据-->
      <div class="bg-color-black item">
        <p class="ml-3 colorBlue fw-b fs-xl" style="font-size: 16px;">汽车总数据量</p>
        <p class="baseCenter_cls">{{ this.centerData.sum_car }}</p>
      </div>
      <div class="bg-color-black item">
        <p class="ml-3 colorBlue fw-b fs-xl" style="font-size: 16px;">销量最高汽车</p>
        <p class="baseCenter_cls">{{ this.centerData.highvolume_car }}</p>
      </div>
      <div class="bg-color-black item">
        <p class="ml-3 colorBlue fw-b fs-xl" style="font-size: 16px;">单车最高销量</p>
        <p class="baseCenter_cls">{{ this.centerData.highcount }}</p>
      </div>
      <div class="bg-color-black item">
        <p class="ml-3 colorBlue fw-b fs-xl" style="font-size: 16px;">销量最高车型</p>
        <p class="baseCenter_cls">{{ this.centerData.most_model }}</p>
      </div>
      <div class="bg-color-black item">
        <p class="ml-3 colorBlue fw-b fs-xl" style="font-size: 16px;">销量最高厂商</p>
        <p class="baseCenter_cls">{{ this.centerData.most_brand }}</p>
      </div>
      <div class="bg-color-black item">
        <p class="ml-3 colorBlue fw-b fs-xl" style="font-size: 16px;">平均价格</p>
        <p class="baseCenter_cls">{{ this.centerData.avg_price }}万元</p>
      </div>
    </div>
    <div class="down">
      <div class="ranking bg-color-black">
        <span>
          <icon name="chart-pie" class="text-icon"></icon>
        </span>
        <span class="fs-xl text mx-2 mb-1 pl-3" style="font-size: 16px;">汽车品牌榜Top10</span>
        <dv-scroll-ranking-board class="dv-scr-rank-board mt-1" :config="ranking" />
      </div>
      <div class="percent">
        <div class="item bg-color-black">
          <span style="margin-left: -10px;">油车占比</span>
          <CenterChart
            :id="rate[0].id"
            :tips="rate[0].tips"
            :colorObj="rate[0].colorData"
          />
        </div>
        <div class="item bg-color-black">
          <span style="margin-left: -10px;">纯电车占比</span>
          <CenterChart
            :id="rate[1].id"
            :tips="rate[1].tips"
            :colorObj="rate[1].colorData"
          />
        </div>
        <div class="water">
          <span style="margin-left: 70px;">混动车占比</span>
          <dv-water-level-pond class="dv-wa-le-po" :config="water" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import CenterChart from '@/components/echart/center/centerChartRate'
import http from '../axios/http'
export default {
  data() {
    return {
      centerData: "",
      // 轮播图 top10数据
      ranking: {
      },
      // 水位图 ，混动汽车占比
      water: {
      },
      // 圆环占比图 油电车占比数据
      rate: [
        {
          id: 'centerRate1',
          tips: 0,
          colorData: {
            textStyle: '#3fc0fb',
            series: {
              color: ['#00bcd44a', 'transparent'],
              dataColor: {
                normal: '#03a9f4',
                shadowColor: '#97e2f5'
              }
            }
          }
        },
        {
          id: 'centerRate2',
          tips: 0,
          colorData: {
            // textStyle: '#67e0e3',
            textStyle: '#ff9800',
            series: {
              color: ['#faf3a378', 'transparent'],
              dataColor: {
                normal: '#ff9800',
                shadowColor: '#fcebad'
              }
            }
          }
        }
      ]
    }
  },
  created(){
    this.get_centerData();
  },
  methods:{
    get_centerData(){
      http.get('/largescreen/index/').then(response=>{
        this.centerData = response.data
        this.ranking = { 
          data: response.data.rolldata_list, 
          carousel: 'single',
          unit: '类',
        }
        this.rate[0].tips = response.data.qiyou_rate
        this.rate[1].tips = response.data.chundian_rate
        this.water = { 
          data: [response.data.other_rate-20, response.data.other_rate],
          shape: 'round',
          formatter: '{value}%',
          waveNum: 3
        }
      }).catch(error=>{
        console.log(error)
      })
    }
  },
  components: {
    CenterChart
  }
}
</script>

<style lang="scss" scoped>
#center {
  display: flex;
  flex-direction: column;
  .up {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    .item {
      border-radius: 6px;
      padding-top: 8px;
      margin-top: 8px;
      width: 32%;
      height: 70px;
      .dv-dig-flop {
        width: 150px;
        height: 30px;
      }
    }
  }
  .down {
    padding: 6px 4px;
    padding-bottom: 0;
    width: 100%;
    display: flex;
    height: 255px;
    justify-content: space-between;
    .bg-color-black {
      border-radius: 5px;
    }
    .ranking {
      padding: 10px;
      width: 59%;
      .dv-scr-rank-board {
        height: 225px;
      }
    }
    .percent {
      width: 40%;
      display: flex;
      flex-wrap: wrap;
      .item {
        width: 50%;
        height: 120px;
        span {
          margin-top: 8px;
          font-size: 14px;
          display: flex;
          justify-content: center;
        }
      }
      .water {
        width: 100%;
        .dv-wa-le-po {
          height: 120px;
        }
      }
    }
  }
}
.baseCenter_cls {
  text-align: center;
  line-height: 46px;
  font-size: 26px;
  color: #6dc2ff;
}
</style>
